Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: keep d.ts files for external libs #859

Merged

Conversation

madsrasmussen
Copy link
Contributor

We were missing the type declaration files for the external libs, which made it problematic to work with typescript. Ex. A package developers wants to extend some element from the UI Library.

The problem was that we deleted the entire external folder (including d.ts. files) when preparing the external libs for the browser through rollup.

I have made a small change that only removes the non browser compatible .js files, before creating the correct .js files. This leaves all the d.ts files behind and typescript is able to pick them up.

I have done a small prepack test of the final output which you can see in the screenshots below.

Be aware, if you set up a custom tsconfig.json file. moduleResolution should be set to bundler to support the exports field in the backoffice npm package.

Screenshot 2023-09-06 at 10 14 16 Screenshot 2023-09-06 at 10 12 06

Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, I'll hand it over to @iOvergaard to do another review.

@iOvergaard
Copy link
Collaborator

Looks good. Approved.

@nielslyngsoe nielslyngsoe merged commit 4795338 into main Sep 6, 2023
7 checks passed
@nielslyngsoe nielslyngsoe deleted the bugfix-missing-external-libs-type-declaration-files branch September 6, 2023 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants